Skip to content

Add a datetime-default-now helper function - #3159

Merged
tyt2y3 merged 1 commit into
SeaQL:masterfrom
goodspark:helpers
Aug 8, 2026
Merged

Add a datetime-default-now helper function#3159
tyt2y3 merged 1 commit into
SeaQL:masterfrom
goodspark:helpers

Conversation

@goodspark

Copy link
Copy Markdown
Contributor

I found I was writing this a lot in my migrations. So why not just put it in the library?

New Features

  • Adds a date_time_default_now helper function for migrations.

I found I was writing this a lot in my migrations. So why not just put
it in the library?
}

/// A date time column with a server-side default of 'now'.
pub fn date_time_default_now<T: IntoIden>(col: T) -> ColumnDef {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now() != CURRENT_TIMESTAMP

Furthermore, CURRENT_TIMESTAMP has different semantics in different databases.

@tyt2y3
tyt2y3 merged commit f7604fe into SeaQL:master Aug 8, 2026
tyt2y3 added a commit that referenced this pull request Aug 8, 2026
Mirror the date_time_default_now helper (#3159) for the timestamp family:
timestamp_default_now and timestamp_with_time_zone_default_now, both
defaulting to Expr::current_timestamp().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants